﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;

namespace IkeCode.WP7.Wakeup.Common
{
    public class BasePhoneAppPage : PhoneApplicationPage
    {
        private object Data;

        public BasePhoneAppPage(object data)
        {
            this.Data = data;
            this.Loaded += BasePhoneAppPage_Loaded;
        }

        public BasePhoneAppPage()
            : base()
        {
            this.Loaded += BasePhoneAppPage_Loaded;
        }

        public virtual void BasePhoneAppPage_Loaded(object sender, RoutedEventArgs e)
        {
            var viewModel = this.DataContext as BaseViewModel;
            if (viewModel != null)
            {
                viewModel.SetData(this.Data);
            }
        }
    }
}
